home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / utils3 / deskmen / !DMen / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1995-01-15  |  27KB  |  1,102 lines

  1.  DeskMen 1.60 (14 Jan 1995)
  2.  (c) 1993,94,95 Ian Clark
  3.  Written by Ian Clark
  4.  In memory of E Clark - Died 19th October 1994 Aged 79
  5. ver$="1.60 (15 Jan 1995)"
  6. $+" at line "+
  7. quit%=
  8. Error
  9.  quit%=
  10.  prefs%?4 
  11.  prefs%?5 
  12. !block%=44
  13. block%!12=0
  14. block%!16=&43B00
  15. +$(block%+20)="DiscLook -UnshadeQuit"+
  16. "Wimp_SendMessage",17,block%,0
  17.  prefs%?4 
  18.  prefs%?6 
  19. !block%=44
  20. block%!12=0
  21. block%!16=&43B00
  22. "$(block%+20)="DiscLook -HD"+
  23. "Wimp_SendMessage",17,block%,0
  24. "WimpExt_CloseDown",id%
  25. "Wimp_CloseDown"
  26.  LOCAL ERROR
  27.  ON ERROR LOCAL SYS"WimpExt_CloseDown",id%:SYS"Wimp_CloseDown",id%,&4B534154:RUN
  28. "Hourglass_On"
  29. block%=0
  30.  buffer% 4
  31.  handles% 28
  32.  indirected% 2825
  33.  ok% 32
  34.  qui% 32
  35.  imm% 32
  36.  prefs% 38
  37. ptr%=0
  38.  SYS"Wimp_OpenTemplate",,"<DMen$Dir>.Templates"
  39.  REPEAT
  40.  SYS"Wimp_LoadTemplate",,0,indirected%,indirected%+2845,-1,"*",ptr% TO ,size%,,,,,ptr%
  41.  IF size%>block% THEN block%=size%
  42.  UNTIL ptr%=0
  43.  SYS"Wimp_CloseTemplate"
  44.  ERROR 0,STR$block%
  45.  block% 2031
  46. ?prefs%=1
  47. prefs%?1=1
  48. prefs%?2=0
  49. prefs%?3=1
  50. prefs%?4=1
  51. prefs%?5=1
  52. prefs%?6=1
  53. prefs%?7=2
  54. $(prefs%+8)="1234"+
  55. $(prefs%+20)="1234"+CHR$0
  56. prefs%!32=25
  57. prefs%?37=0
  58. prefs%?38=1
  59. C%$qui%="Quit"+
  60. 0+"Cancel"+
  61. $ok%="OK"+
  62. E#$imm%="OK"+
  63. 0+"Cancel"+
  64. shutdown%=
  65. running%=
  66. task%=
  67. open%=
  68. toquit%=
  69. qol%=
  70. password%=0
  71. correct%=0
  72. idle$=""
  73. Oe!block%=3:block%!4=&502:block%!8=&400C2:block%!12=&400C3:block%!16=1:block%!20=2:block%!24=&45782
  74. "Wimp_Initialise",310,&4B534154,"DeskMen",block% 
  75.  ver%,id%
  76.  ver%<310 
  77.  0,"DeskMen needs Risc OS 3.10 or later"
  78. "WimpExt_Initialise",16,id%,%1010011010 
  79.  ver%
  80.  ver%<195 
  81.  0,"DeskMen needs Wimp Extentions 1.95 or later. (There is a copy inside the !DMen directory.)"
  82. "OS_File",13,"<DMen$Dir>.Sprites" 
  83.  ,,,,size%
  84. size%+=4:
  85.  sprite% size%
  86. !sprite%=size%:sprite%!8=16
  87. "OS_SpriteOp",&209,sprite%
  88. "OS_SpriteOp",&20A,sprite%,"<DMen$Dir>.Sprites"
  89.  x%=0 
  90. handles%!x%=%101:
  91. handles%!8=0:handles%!12=0
  92. "WimpExt_LoadTemplates",handles%,block%,indirected%,indirected%+2825,-1,"<DMen$Dir>.Templates",sprite%
  93. menuw%=!handles%
  94. pwordw%=handles%!4
  95. optionsw%=handles%!8
  96. panew%=handles%!12
  97. infow%=handles%!16
  98. errorw%=handles%!20
  99. savew%=handles%!24
  100. "WimpExt_Heap",0,
  101. "WimpExt_SetIconString",,,infow%,3,ver$
  102. PROCRedrawcode
  103. Loadprefs
  104. Startup
  105. tsk%=id%
  106. "WimpExt_LinkWindows",,,optionsw%,panew%
  107.  Create a directory in <DMen$Scrap>
  108.  This is the same as <Wimp$ScrapDir> if it is set
  109.  else it is the application directory
  110. "OS_File",8,"<DMen$Scrap>.DeskMen"
  111. Exists("<DMen$Scrap>.DeskMen.Swap") 
  112. "OS_File",6,"<DMen$Scrap>.DeskMen.Swap"
  113.  title$
  114. title$="Desk Men"
  115.  barmenu% 28+(24*4)
  116. $barmenu%=title$
  117. width%=(
  118. title$-1)*16
  119. barmenu%?12=7
  120. barmenu%?13=2
  121. barmenu%?14=7
  122. barmenu%?15=0
  123. barmenu%!20=44
  124. barmenu%!24=0
  125.  The procedure below adds a single item to a menu.
  126.    Item Text Flag Item Menu Submenu Pointer
  127.            |    | |    |       |
  128.           \ /  \/\/   \ /     \ /
  129. Additem("Info",2,1,barmenu%,infow%)
  130. Additem("Options...",0,2,barmenu%,-1)
  131. Additem("Save menu",2,3,barmenu%,savew%)
  132. Additem("Quit",&80,4,barmenu%,-1)
  133. barmenu%!16=width%
  134. Imm(text$)
  135. Errbox("Message from DeskMen",text$,1)
  136. Errbox(title$,text$,bflag%)
  137.  bt%,pressed%
  138.  bflag% 
  139.  1 : bt%=ok%
  140.  2 : bt%=imm%
  141.  3 : bt%=qui%
  142.  : bt%=ok%
  143. "WimpExt_ControlImmediate",,2,title$,text$,bt%,1 
  144.  pressed%
  145. =pressed%
  146. Decodemenu
  147.  buffer% 512
  148. "Wimp_DecodeMenu",,menu%,block%,buffer%
  149.  menu% 
  150.  barmenu% : 
  151.  $buffer% 
  152.                   
  153.  "Info" : 
  154. Imm("Desk Men is another RJ Deveolpments production, it provides a simple, secure menu system for your machine.")
  155. 1                  
  156.  "Options..." : 
  157. Openprefs
  158. (                  
  159.  "Quit" : quit%=
  160. >                  
  161. Imm("That menu item does nothing!")
  162.                  
  163. Additem(item$,flag%,item%,menu%,submenu%)
  164. item$>12 
  165.  0,"The menu item '"+item$+"' is too long! Must exit imeditaly!!"
  166. item$+1)*16>width% 
  167.  width%=(
  168. item$+1)*16
  169. P%=menu%+28+(24*(item%-1))
  170.     OPT 0
  171. EQUD flag%
  172. EQUD submenu%
  173. EQUD &7000021
  174. !EQUS item$+
  175. item$-1),
  176. Error
  177. hbt%=
  178. Errbox("Error from DeskMen","Error: '"+
  179. $+"' - Internal error code "+
  180. +". What sould I do?",3)
  181.  bt% 
  182.  0 : quit%=
  183.  swi$
  184.  quit% 
  185. swi$="Wimp_Poll"+idle$
  186. "WimpExt_PrePoll"
  187. swi$,0,block%,
  188. +prefs%!32 
  189.  code%
  190. "WimpExt_Action",id%,block%,code% 
  191.  code%
  192.  code% 
  193.  0 : 
  194.  1 : 
  195. Redraw:
  196. SYS"WimpExt_AutoRedraw",,block%
  197.  2 : 
  198. "WimpExt_OpenLinked",,block%
  199.  3 : 
  200. "WimpExt_CloseLinked",,block%
  201.  6 : 
  202. Click(block%!8,block%!12,block%!16,!block%,block%!4)
  203.  7 : 
  204. Dragdropped
  205.  8 : 
  206. Processkey
  207.  9 : 
  208. Decodemenu
  209.   WHEN 10 : PROCScroll
  210.  17,18 : 
  211. Receive
  212. Exists(path$)
  213. "OS_File",17,path$ 
  214.  found%
  215.  found%=0 =
  216. Startup
  217. "Hourglass_On"
  218. Exists("<DMen$Dir>.MenuDef") 
  219. Nofile:
  220. Loadmenu
  221.  quit%=2 
  222.  quit%=
  223. Nofile:
  224.  quit% 
  225. Openmain
  226. Nofile
  227. "WimpExt_ShadeEntry",,barmenu%,2,1
  228. Imm("Deskmen isn't able to find the menu defenition file, please read the section 'Createing a new menu' in the help file.")
  229. "WimpExt_IconBarSprite",,,-1,"!DMen",,3 
  230.  baricon%
  231. Click(b%,w%,i%,x%,y%)
  232.  -2 : 
  233. $            
  234.  baricon% : 
  235. n                             
  236.  2 : menu%=barmenu%:
  237.  "WimpExt_CreateMenu",,barmenu%,x%-64,96+(44*4)+(24*2)
  238. 1                             
  239.  1 : 
  240. Openprefs
  241. f                             
  242.  4 : 
  243. Exists("<DMen$Dir>.MenuDef") 
  244. Openprefs 
  245. Menufromiconbar
  246. !                            
  247.            
  248.  optionsw% : 
  249. #                   
  250.  0 : 
  251. Optok
  252. '                   
  253.  1 : 
  254. Optcancel
  255. %                   
  256.  2 : 
  257. Optsave
  258.                   
  259.  menuw% : 
  260. 9                
  261.  1,2,3,4,5,6,7,8,9,10 : 
  262. Doclick(i%)
  263. &                
  264.  11 : 
  265. Exittodesk
  266. $                
  267.  12 : 
  268. Shutdown
  269. #                
  270.  13 : 
  271. Backone
  272.                
  273.  pwordw% : 
  274.  i%=2 
  275. Isitgood
  276.  savew%  : 
  277. Savedef
  278. String(ptr%)
  279.  ?ptr%>25 
  280. tx$<255
  281. tx$+=
  282. (?ptr%):ptr%+=1
  283. Openprefs
  284. Setpreficons
  285. "WimpExt_OpenWindowTop",optionsw%
  286. Setpreficons
  287. "WimpExt_SetIcon",,,panew%,2,?prefs%
  288. "WimpExt_SetIcon",,,panew%,4,prefs%?1
  289. "WimpExt_SetIcon",,,panew%,3,prefs%?2
  290. "WimpExt_SetIcon",,,panew%,7,prefs%?3
  291. "WimpExt_SetIcon",,,panew%,8,prefs%?4
  292. "WimpExt_SetIcon",,,panew%,9,prefs%?5
  293. "WimpExt_SetIcon",,,panew%,10,prefs%?6
  294. "WimpExt_SetIcon",,,panew%,20,prefs%?37
  295. "WimpExt_SetIcon",,,panew%,21,prefs%?38
  296. "WimpExt_SetIconString",,,panew%,6,
  297. String(prefs%+8)
  298.  SYS"WimpExt_SetIconString",,,panew%,7,FNString(prefs%+20)
  299. "WimpExt_SetNumberIcon",,,panew%,17,prefs%!32
  300. "WimpExt_SetIcon",,,panew%,13,prefs%?7 
  301. "WimpExt_SetIcon",,,panew%,15,prefs%?7 
  302. "WimpExt_SetIcon",,,panew%,14,prefs%?7 
  303. Optcancel
  304. "5!block%=optionsw%:
  305. "WimpExt_CloseLinked",,block%
  306. Optok
  307.  text%,ptr%,tmp%
  308.  SYS"WimpExt_GetIcon",,,optionsw%,7 TO ,,,text%
  309.  $(block%+12)=FNString(text%)
  310.  same%=TRUE
  311.  ptr%=0
  312.  REPEAT
  313.  IF block%?ptr%<>block%?(12+ptr%) THEN same%=FALSE
  314.  ptr%+=1
  315.  IF ptr%>10 THEN same%=FALSE:block%?ptr%=0
  316.  UNTIL block%?ptr%<32 AND block%?(12+ptr%)<32
  317.  IF NOT same% PROCImm("You ** MUST ** provide a password in both boxes, and they must be the same!"):ENDPROC
  318. "WimpExt_GetIcon",,,panew%,2 
  319.  ?prefs%
  320. "WimpExt_GetIcon",,,panew%,4 
  321.  prefs%?1
  322. "WimpExt_GetIcon",,,panew%,3 
  323.  prefs%?2
  324. "WimpExt_GetIcon",,,panew%,7 
  325.  prefs%?3
  326. "WimpExt_GetIcon",,,panew%,8 
  327.  prefs%?4
  328. "WimpExt_GetIcon",,,panew%,9 
  329.  prefs%?5
  330. "WimpExt_GetIcon",,,panew%,10 
  331.  prefs%?6
  332. "WimpExt_GetIcon",,,panew%,20 
  333.  prefs%?37
  334. "WimpExt_GetIcon",,,panew%,21 
  335.  prefs%?38
  336. "WimpExt_GetIcon",,,panew%,6 
  337.  ,,,text%
  338. $(prefs%+8)=
  339. String(text%)
  340.  SYS"WimpExt_GetIcon",,,panew%,7 TO ,,,text%
  341.  $(prefs%+20)=FNString(text%)
  342. "WimpExt_GetIcon",,,panew%,13 
  343.  prefs%?7:idle$=""
  344. "WimpExt_GetIcon",,,panew%,15 
  345.  tmp%
  346.  tmp% prefs%?7=2:idle$="Idle"
  347. "WimpExt_GetIcon",,,panew%,14 
  348.  tmp%
  349.  tmp% prefs%?7=4:idle$="Idle"
  350. "WimpExt_GetNumberIcon",,,panew%,17 
  351.  prefs%!32
  352. D5!block%=optionsw%:
  353. "WimpExt_CloseLinked",,block%
  354. Optsave
  355. Optok
  356. Optsv
  357. Optsv
  358. "OS_File",10,"<DMen$Dir>.Prefs",&FFD,,prefs%,prefs%+39
  359. "OS_File",16,"<DMen$Dir>.Prefs",block%
  360.  x%=block% 
  361.  block%+39
  362. ?x%=?x% 
  363. "OS_File",10,"<DMen$Dir>.Prefs",&FFD,,block%,block%+39
  364. Loadprefs
  365. Exists("<DMen$Dir>.Prefs") 
  366. Imm("Desk Men can't find the options file - using defaults."):
  367. Optsv:
  368. "XOS_File",16,"<DMen$Dir>.Prefs",block%,0 
  369. ;error%
  370.  error% 
  371. Imm("Error when reading options file - using defaults.") 
  372. Decrypt:
  373. "XOS_File",4,"<DMen$Dir>.Prefs",,,,%110011
  374. "XOS_File",6,"<DMen$Dir>.Prefs"
  375. Optsv
  376. Decrypt
  377.  x%=block% 
  378.  block%+39
  379. ?x%=?x% 
  380. "WimpExt_MemCopy",block%,prefs%,39
  381.  prefs%?4=0 
  382.  prefs%?5=1 
  383. !block%=40
  384. block%!12=0
  385. block%!16=&43B00
  386. h)$(block%+20)="DiscLook -ShadeQuit"+
  387. "Wimp_SendMessage",17,block%,0
  388.  prefs%?6=1 
  389. !block%=40
  390. block%!12=0
  391. block%!16=&43B00
  392. o$$(block%+20)="DiscLook -NoHD"+
  393. "Wimp_SendMessage",17,block%,0
  394. Receive
  395.  block%!16 
  396.  0 : 
  397.  shutdown% quit%=
  398.  toquit%=
  399. Exittodesk
  400.  3 : 
  401.  block%!40 
  402. x9           
  403.  &FFF : 
  404. Readtextfile(
  405. String(block%+44))
  406.           
  407.  &502 : 
  408.  block%!32 
  409.               
  410.  infow% : 
  411.  block%!36=-1 
  412. Sendhelp("See also 'Risc Tracker', another funky RJ Deveolpments product, the funky digital symphony player.")
  413.               
  414.  menuw% : 
  415.  block%!36=-1 
  416. Sendhelp("This is the menu window, notice those nice caring details, like the shutdown button.") 
  417. Sendhelp("This is a menu button, go on, have a prod!")
  418.               
  419.  -2 : 
  420.  block%!36=baricon% 
  421. Sendhelp("This is the DeskMen icon, another RJ Production.|mThis is release two of this funky application.|mIt now supports menu TREES (Yeah!!!!).")
  422.               
  423. Menuhelp
  424.              
  425.  &400C2 : 
  426. Taskstarted
  427.  &400C3 : 
  428. Taskdied
  429.  &45782 : 
  430. Saveerror(block%+20)
  431. Readtextfile(path$)
  432.  tag%
  433.  Procedure to create menu from text file,
  434.  use | for comments
  435.  use { to start menu, ie "{Main menu",
  436.  then item, and then path, end with }
  437. "OS_Find",&43,path$ 
  438.  handle%
  439.     st%=0
  440. end%=0
  441. "XOS_GBPB",4,handle%,block%,1
  442. (!block%)="{" 
  443.  st%+=1
  444. (!block%)="}" 
  445.  end%+=1
  446. #handle%
  447. "OS_Find",0,handle%
  448.  st%<>end% 
  449.  st%=0 
  450. Imm("Error when reading menu file: Mismatched '{' and '}'."):
  451. "OS_File",17,path$ 
  452.  ,,,,len%
  453. len%+=4
  454. "WimpExt_Heap",2,,len% 
  455.  ,menblk%
  456.  menblk%=0 
  457. Imm("Error when createing menu: Memory allocation failed, try freeing some memory and trying again,")
  458. "OS_Find",&43,path$ 
  459.  handle%
  460. mem%=4
  461. men%=0
  462.     er%=
  463. line$=
  464. #handle%
  465. line$,1) 
  466.  "|" : 
  467.  You need this line to prevent processing of these lines
  468.  "{" : 
  469. Getandstoretitle
  470.  "}" : $((!menblk%)+mem%)=line$+
  471. 0:mem%+=
  472. line$+1:men%=men%-1
  473. Process
  474. #handle% 
  475. "OS_Find",0,handle%
  476. "OS_Find",&43,path$ 
  477.  handle%
  478.  men%<>0 
  479.  er% 
  480. Imm("Error when creating menu: The number of end menu markers is wrong.")
  481.  er% 
  482.  x%=!menblk%+4 
  483.  !menblk%+mem%
  484. ?x%=?x% 
  485. tag%=!menblk%
  486. *?tag%=77:tag%?1=69:tag%?2=78:tag%?3=85
  487.  er% 
  488. "OS_File",10,"<DMen$Dir>.MenuDef",&300,,!menblk%,!menblk%+mem%
  489. "OS_Find",0,handle%
  490. Errbox("Message from DeskMen","Your menu file has been created. If you need to change it back to text use the convert utility supplied with the program. To see your menu click OK, otherwise click CANCEL",2)=1 
  491. "WimpExt_CloseDown",id%
  492. "Wimp_CloseDown"
  493. Getandstoretitle
  494. line$>39 
  495.  er%=
  496. Imm("The title '"+
  497. line$,2)+"' is too long."):
  498. $((!menblk%)+mem%)=line$+
  499. mem%+=
  500. line$+1
  501. men%+=1
  502. Process
  503.  men%<=0 
  504. Imm("Error when creating menu: Syntax error in definition file."):er%=
  505. line$>27 
  506.  er%=
  507. Imm("The item '"+line$+"' is too long."):
  508. $((!menblk%)+mem%)=line$+
  509. mem%+=
  510. line$+1
  511. line$=
  512. #handle%
  513.  line$="}" 
  514.  $((!menblk%)+mem%)=line$+
  515. 0:mem%+=
  516. line$+1:men%=men%-1:
  517. line$,1) 
  518.  "|" : 
  519.  "{" : 
  520. Getandstoretitle:
  521.  "}" : $((!menblk%)+mem%)=line$+
  522. 0:mem%+=
  523. line$+1:men%=men%-1:
  524. "XOS_File",17,line$ 
  525.  found%
  526.  found%=0 
  527. Imm("Error when creating menu: Item '"+line$+"' dosen't exist."):er%=
  528. $((!menblk%)+mem%)=line$+
  529. mem%+=
  530. line$+1
  531. Loadmenu
  532. "XOS_File",17,"<DMen$Dir>.MenuDef" 
  533.  ,,,,len%;error%
  534.  error% 
  535. Imm("Fatal error: Error when reading menu definiton file, suggest delete file and re-create. Must exit and die."):quit%=
  536. "WimpExt_Heap",2,,len% 
  537.  ,menhand%
  538.  menhand%=0 
  539. Imm("Fatal error: Memory allocation failed, try freeing some memory, then re-load"):quit%=
  540. menblk%=!menhand%
  541. "OS_File",16,"<DMen$Dir>.MenuDef",menblk%,0
  542.  x%=0 
  543. id$+=
  544. (menblk%?x%)
  545.  id$<>"MENU" quit%=2:
  546. Imm("This is an old style menu file, or file is corrupt."):
  547.  x%=menblk%+4 
  548.  menblk%+len%
  549. ?x%=?x% 
  550. !menblk%=!(menblk%-4)-4
  551. menblk%+=4
  552. "Hourglass_Smash"
  553. "WimpExt_ShadeEntry",,barmenu%,2,0
  554. Openmain
  555. Wipemenu
  556. len%=!(menblk%-4)
  557. curmenu%=1
  558. curritem%=1
  559. ptr%=menblk%
  560. title$=
  561. String(ptr%)
  562. ptr%+=
  563. title$+1
  564. title$=
  565. title$,2)
  566. "WimpExt_SetWindowTitle",,,menuw%,title$
  567.  ptr%>menblk%+len% 
  568. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  569. item$=
  570. String(ptr%)
  571. ptr%+=
  572. item$+1
  573. path$=
  574. String(ptr%)
  575. ptr%+=
  576. path$+1
  577. path$,1)="{" 
  578. "WimpExt_SetIconColour",,,menuw%,curritem%,-1,2:
  579. Skipmenu
  580.  item$<>"}" 
  581. "WimpExt_SetIconString",,,menuw%,curritem%,item$:curritem%+=1
  582.  curritem%>=11 
  583.  item$="}"
  584.  curritem%<=11 
  585.  x%=curritem% 
  586.  SYS"WimpExt_ShadeIcon",,,menuw%,x%,1
  587. =!block%=menuw%:block%!4=x%:block%!8=1<<23:block%!12=1<<23
  588. "Wimp_SetIconState",,block%
  589. =!block%=menuw%:block%!4=13:block%!8=1<<23:block%!12=1<<23
  590. "Wimp_SetIconState",,block%
  591.  SYS"WimpExt_ShadeIcon",,,menuw%,13,1
  592. 9!block%=menuw%:block%!4=11:block%!8=0:block%!12=1<<23
  593. "Wimp_SetIconState",,block%
  594.  SYS"WimpExt_ShadeIcon",,,menuw%,11,0
  595. "WimpExt_OpenWindowTop",menuw%
  596. Skipmenu
  597. ptr%=ptr%-1
  598.  ptr%+=1
  599.  ?ptr%=
  600. ("{") ptr%+=1:
  601. Skipmenu
  602.  ?ptr%=
  603. ("}") 
  604.  ptr%>menblk%+len%
  605. ptr%=ptr%+2
  606. Doclick(item%)
  607. "WimpExt_GetIcon",,,menuw%,item% 
  608. ,,,ptr%
  609. item$=
  610. String(ptr%)
  611. len%=!(menblk%-4)
  612. ptr%=menblk%
  613. ptr%=ptr%-1
  614.  ptr%+=1
  615. text$=
  616. String(ptr%)
  617. ptr%+=
  618. text$
  619.  text$=item$ 
  620.  ptr%>menblk%+len%
  621.  ptr%>menblk%+len% 
  622. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  623. ptr%+=1
  624. path$=
  625. String(ptr%)
  626. path$,1) 
  627.  "{" : 
  628. Gomenu
  629.  "*" : 
  630. "XOS_CLI",path$
  631. Load(path$)
  632. Sendhelp(help$)
  633. "WimpExt_SendHelp",help$,block%
  634. Menuhelp
  635. "Wimp_GetMenuState",1,buffer%,block%!32,block%!36
  636.  !buffer% 
  637.  3 : 
  638. Sendhelp("Click here to quit DeskMen, though why you'd want to is beyond me!")
  639.  2 : 
  640. Sendhelp("Slide right to reveal a save box, this allows you to save the menu in plain text, ready for editing.")
  641.  1 : 
  642. Sendhelp("Click here to open the options window, this allows you to customise various aspects of DeskMen. The options window can also be opened by clicking ajust on the iconbar icon.")
  643.  0 : 
  644. Sendhelp("This option leads to a standard info box.")
  645.  -1 : 
  646. Sendhelp("Ohh! Your sooooooo good with that mouse!!")
  647. Gomenu
  648. len%=!(menblk%-4)
  649. ptr%=menblk%
  650. ptr%=ptr%-1
  651. curmenu%=0
  652.  ptr%+=1
  653. text$=
  654. String(ptr%)
  655. text$,1)="{" 
  656.  curmenu%+=1
  657. ptr%+=
  658. text$
  659.  text$=path$ 
  660.  ptr%>menblk%+len%
  661.  ptr%>menblk%+len% 
  662. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  663. ptr%=ptr%-
  664. text$
  665. !block%=menuw%
  666. "Wimp_CloseWindow",,block%
  667. curritem%=1
  668. Wipemenu
  669. title$=
  670. String(ptr%)
  671. ptr%+=
  672. title$+1
  673. title$=
  674. title$,2)
  675. "WimpExt_SetWindowTitle",,,menuw%,title$
  676.  ptr%>menblk%+len% 
  677. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  678. item$=
  679. String(ptr%)
  680. ptr%+=
  681. item$+1
  682. path$=
  683. String(ptr%)
  684. ptr%+=
  685. path$+1
  686. path$,1)="{" 
  687. "WimpExt_SetIconColour",,,menuw%,curritem%,-1,2:
  688. Skipmenu
  689.  item$<>"}" 
  690. "WimpExt_SetIconString",,,menuw%,curritem%,item$:curritem%+=1
  691.  curritem%>=11 
  692.  item$="}"
  693.  curritem%<=10 
  694.  x%=curritem% 
  695.  SYS"WimpExt_ShadeIcon",,,menuw%,x%,1
  696. T=!block%=menuw%:block%!4=x%:block%!8=1<<23:block%!12=1<<23
  697. "Wimp_SetIconState",,block%
  698.  curmenu%=1 
  699.  !block%=menuw%:block%!4=13:block%!8=1<<23:block%!12=1<<23:
  700. "Wimp_SetIconState",,block%
  701. "WimpExt_OpenWindowTop",menuw%
  702. "Wimp_SetCaretPosition",menuw%,-1
  703. Wipemenu
  704.  SYS"WimpExt_ShadeIcon",,,menuw%,13,0
  705. _W!block%=menuw%:block%!4=13:block%!8=0:block%!12=1<<23:
  706. "Wimp_SetIconState",,block%
  707.  x%=1 
  708. aW!block%=menuw%:block%!4=x%:block%!8=0:block%!12=1<<23:
  709. "Wimp_SetIconState",,block%
  710. "WimpExt_SetIconString",,,menuw%,x%,""
  711. "WimpExt_SetIconColour",,,menuw%,x%,-1,1
  712.  SYS"WimpExt_ShadeIcon",,,menuw%,x%,0
  713. Backone
  714. "WimpExt_GetIcon",,,menuw%,1 
  715. ,,,ptr%
  716. item$=
  717. String(ptr%)
  718. len%=!(menblk%-4)
  719. ptr%=menblk%
  720. ptr%=ptr%-1
  721.  ptr%+=1
  722. text$=
  723. String(ptr%)
  724. ptr%+=
  725. text$
  726.  text$=item$ 
  727.  ptr%>menblk%+len%
  728.  ptr%>menblk%+len% 
  729. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  730. count%=-2
  731.  ptr%=ptr%-1
  732. text$=
  733. Backstring(ptr%)
  734. text$,1)="{" 
  735.  count%+=1
  736.  text$="}" 
  737.  count%=count%-1
  738.  ptr%-
  739. text$>=menblk% ptr%-=
  740. text$
  741.  count%=0 
  742.  ptr%<menblk%
  743.  ptr%<menblk% 
  744. Imm("Backtracked too far!"):
  745. len%=!(menblk%-4)
  746. ptr%=menblk%
  747. ptr%=ptr%-1
  748. count%=0
  749.  ptr%+=1
  750. txt$=
  751. String(ptr%)
  752. txt$,1)="{" 
  753.  txt$<>text$ 
  754.  count%+=1
  755.  txt$="}" 
  756.  count%=count%-1
  757. ptr%+=
  758.  txt$=text$ 
  759.  ptr%>menblk%+len%
  760.  ptr%>menblk%+len% 
  761. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  762. curmenu%=count%
  763. ptr%=ptr%-
  764. !block%=menuw%
  765. "Wimp_CloseWindow",,block%
  766. curritem%=1
  767. Wipemenu
  768. title$=
  769. String(ptr%)
  770. ptr%+=
  771. title$+1
  772. title$=
  773. title$,2)
  774. "WimpExt_SetWindowTitle",,,menuw%,title$
  775.  ptr%>menblk%+len% 
  776. Imm("Swirly thing alert - Many overflow my memory has? I'm feeling rather depressed! Shall exit and die."):quit%=
  777. item$=
  778. String(ptr%)
  779. ptr%+=
  780. item$+1
  781. path$=
  782. String(ptr%)
  783. ptr%+=
  784. path$+1  
  785. path$,1)="{" 
  786. "WimpExt_SetIconColour",,,menuw%,curritem%,-1,2:
  787. Skipmenu
  788.  item$<>"}" 
  789. "WimpExt_SetIconString",,,menuw%,curritem%,item$:curritem%+=1
  790.  curritem%>=11 
  791.  item$="}"
  792.  curritem%<=10 
  793.  x%=curritem% 
  794.  SYS"WimpExt_ShadeIcon",,,menuw%,x%,1
  795. =!block%=menuw%:block%!4=x%:block%!8=1<<23:block%!12=1<<23
  796. "Wimp_SetIconState",,block%
  797.  curmenu%=0 
  798.  !block%=menuw%:block%!4=13:block%!8=1<<23:block%!12=1<<23:
  799. "Wimp_SetIconState",,block%
  800. "WimpExt_OpenWindowTop",menuw%
  801. "Wimp_SetCaretPosition",menuw%,-1
  802. Backstring(ptr%)
  803.  ?ptr%>25 
  804. tx$<255
  805.  tx$=
  806. (?ptr%)+tx$:ptr%=ptr%-1
  807. Load(path$)
  808. dontexit%=
  809. path$,1)="-" 
  810.  path$=
  811. path$,2):dontexit%=
  812. path$,1)="+" 
  813.  path$=
  814. path$,2):dontexit%=
  815. :qol%=
  816.  prefs%?4=0 
  817. "XWimp_StartTask","Run "+path$ 
  818. ;error%
  819.  error% 
  820.  1 quit%=
  821.  prefs%?38=0 
  822.  dontexit% 
  823. "XWimp_StartTask","Run "+path$ 
  824. ;error%
  825.  dontexit% 
  826.  task%=
  827.  task%=
  828. dontexit%=
  829. ("<DMen$Scrap>.DeskMen.Swap")
  830. #x%,"| This is the DeskMen task swapping file"
  831. #x%,"| It is used to re-load the menu when the current application"
  832. #x%,"| has quit. It should not be deleted."
  833. #x%,"|"
  834. #x%,"Run "+path$
  835. #x%,"Run <DMen$Dir>.!Run";
  836. "OS_CLI","SetType <DMen$Scrap>.DeskMen.Swap Obey"
  837. "XWimp_StartTask","Filer_Run <DMen$Scrap>.DeskMen.Swap"
  838. "WimpExt_ReleasePointer"
  839. quit%=
  840. Taskstarted
  841.  block%!4=id% 
  842. String(block%+28)="Disc Look II" 
  843.  qol% 
  844. Quitit
  845.  task% 
  846.  running% 
  847. !block%=menuw%
  848. "Wimp_CloseWindow",,block%
  849. "WimpExt_ReleasePointer"
  850. "Wimp_SetCaretPosition",-1
  851. tsk%=block%!4
  852.  prefs%?3=0 
  853.  quit%=
  854. running%=
  855.  prefs%?7 
  856.  idle$="Idle"
  857. Taskdied
  858.  task% 
  859.  block%!4<>tsk% 
  860. running%=
  861. "WimpExt_OpenWindowTop",menuw%
  862. "WimpExt_LimitPointer",menuw%
  863. "Wimp_SetCaretPosition",menuw%,-1
  864.  prefs%?7 
  865.  idle$=""
  866. Quitit
  867. qol%=
  868. tsk%=block%!4
  869. &!block%=20:block%!16=0:block%!12=0
  870. "Wimp_SendMessage",17,block%,tsk%
  871.  IF prefs%?7 AND 2 THEN
  872.  IF NOT task% THEN idle$="" ELSE idle$="Idle"
  873.  ENDIF
  874.  password%<>0 
  875.  open% 
  876. Openpword
  877.  correct%=1 
  878. Isgood 
  879.  correct%=2 
  880. Iswrong
  881.  task% 
  882. "WimpExt_CheckWindowOpen",menuw% 
  883.  open%
  884.  open%=0 
  885. "WimpExt_ReleasePointer":
  886. "WimpExt_LimitPointer",menuw%
  887. "Wimp_SetCaretPosition",menuw%,-1
  888. Processkey
  889.  task% 
  890.  block%!24 
  891.  &1CC : 
  892.  &1DC : 
  893.  &1EC : 
  894.  &1FC : 
  895. Click(1,menuw%,12,0,0)
  896.  &D   : 
  897.  !block%=panew% 
  898. Optok
  899. "Wimp_ProcessKey",block%!24
  900. Shutdown
  901.  ?prefs%=1 
  902.  prefs%?2=1 
  903.  password%=1 
  904. Shutdown2
  905. Shutdown2
  906. shutdown%=
  907.  prefs%?4=0 
  908. "TaskManager_Shutdown":
  909. !block%=44
  910. block%!12=0
  911. block%!16=&43B00
  912. +$(block%+20)="DiscLook -UnshadeQuit"+
  913. "Wimp_SendMessage",17,block%,0
  914.  $(block%+20)="DiscLook -Quit"+CHR$0
  915.  SYS"Wimp_SendMessage",17,block%,0
  916. "TaskManager_Shutdown"
  917. Exittodesk
  918.  ?prefs%=1 
  919.  prefs%?1=1 
  920.  password%=2 
  921. Exit2
  922. Exit2
  923.  toquit%=
  924.  quit%=
  925. running%=
  926. task%=
  927. "WimpExt_IconBarSprite",,,-1,"!DMen",,3 
  928.  baricon%
  929.  /!block%=menuw%:
  930. "Wimp_CloseWindow",,block%
  931.  prefs%?7 
  932.  idle$="Idle"
  933. Openpword
  934. "WimpExt_SetIconString",,,pwordw%,1,""
  935. "WimpExt_OpenWindowTop",pwordw%
  936. "WimpExt_LimitPointer",pwordw%
  937. "WimpExt_MoveCaretIcon",,,pwordw%,1
  938. open%=
  939. Isitgood
  940. "WimpExt_GetIcon",,,pwordw%,1 
  941. ,,,ptr%
  942.  prefs%?37=1 
  943.  pword$=
  944. String(ptr%) 
  945.  pword$=
  946. LCString(ptr%)
  947.  prefs%?37=1 
  948.  correct$=
  949. String(prefs%+8) 
  950.  correct$=
  951. LCString(prefs%+8)
  952.  pword$=correct$ correct%=1 
  953.  correct%=2
  954. Isgood
  955. open%=
  956. correct%=0
  957.  password% 
  958.  2 : password%=0:
  959. Exit2
  960.  1 : password%=0:
  961. Shutdown2
  962. !block%=pwordw%
  963. "Wimp_CloseWindow",,block%
  964. "WimpExt_ReleasePointer"
  965. Iswrong
  966. open%=
  967. correct%=0
  968. password%=0
  969. Imm("That password is incorrect.")
  970. !block%=pwordw%
  971. "Wimp_CloseWindow",,block%
  972. "WimpExt_ReleasePointer"
  973. Menufromiconbar
  974. !block%=-2
  975. block%!4=baricon%
  976. "Wimp_DeleteIcon",,block%
  977.  x%=1 
  978. "WimpExt_ShadeIcon",,,menuw%,x%,0
  979.  prefs%?7 
  980.  idle$=""
  981. Openmain
  982. Scroll
  983.  block%!36>0 
  984.  block%!24+=30 
  985.  block%!24-=30
  986. "WimpExt_OpenLinked",,block%
  987.  prefs%?4=0 
  988.  prefs%?5=1 
  989. !block%=40
  990. block%!12=0
  991. block%!16=&43B00
  992. _)$(block%+20)="DiscLook -ShadeQuit"+
  993. "Wimp_SendMessage",17,block%,0
  994.  prefs%?6=1 
  995. !block%=40
  996. block%!12=0
  997. block%!16=&43B00
  998. f$$(block%+20)="DiscLook -NoHD"+
  999. "Wimp_SendMessage",17,block%,0
  1000. RJInfo
  1001. "WimpExt_OpenWindowTop",rjinfow%
  1002. "WimpExt_LimitPointer",rjinfow%
  1003. Redraw
  1004. tile$="tile"
  1005. "OS_SpriteOp",256+40,sprite%,tile$ 
  1006.  ,,,width%,height%
  1007.  "Wimp_RedrawWindow",,block% 
  1008.  more%
  1009.  more%
  1010. !(block%+44)=!block%
  1011. "Wimp_GetWindowState",,block%+44
  1012. x%=block%!48-block%!64
  1013.  x%+width%*2<block%!28
  1014. x%+=width%*2
  1015.  x%>block%!28
  1016. x%-=width%*2
  1017. y%=block%!60-block%!68
  1018.  y%+height%*2<block%!32
  1019. y%+=height%*2
  1020.  y%>block%!32
  1021. y%-=height%*2
  1022. sy%=y%
  1023.  x%<block%!36
  1024.  y%<block%!40
  1025. "WimpExt_SpriteOp",256,sprite%,tile$,x%,y%,8
  1026. y%+=height%*2
  1027. y%=sy%
  1028. x%+=width%*2
  1029. "WimpExt_Redraw",,block%
  1030. "Wimp_GetRectangle",,block% 
  1031.  more%
  1032. Savedef
  1033.  3 : 
  1034.  b%=16 
  1035.  b%=64 
  1036. "WimpExt_DragIcon",128,1,savew%,3,"file_fff"
  1037.  2 : 
  1038. Savepath
  1039. Savepath
  1040.  path$,path%,start%,end%
  1041. Imm("File may not have saved correctly due to '"+
  1042. $+"'"):
  1043. "WimpExt_GetIcon",,,savew%,1 
  1044.  ,,,path%
  1045. path$=
  1046. String(path%)
  1047. path$,".")=0 
  1048. Imm("You must provide a valid path"):
  1049. start%=!menhand%
  1050. end%=start%+!(start%-4)
  1051. start%+=4
  1052.  x%=start% 
  1053.  end%:
  1054.  ?x%=0 
  1055.  ?x%=&A
  1056. "OS_File",10,path$,&FFF,,start%,end%-4 
  1057.  ;error%
  1058.  x%=start% 
  1059.  end%:
  1060.  ?x%=&A 
  1061.  ?x%=0
  1062.  error% 
  1063. Imm("File may not have saved correctly due to '"+
  1064. $+"'"):
  1065. *!block%=savew%:
  1066. "Wimp_CreateMenu",,-1
  1067. Dragdropped
  1068.  path$,f%,path%,end%,start%
  1069. "XDragASprite_Stop"
  1070. "WimpExt_GetIcon",,,savew%,1 
  1071.  ,,,path%
  1072. path$=
  1073. String(path%)
  1074.  path$="" 
  1075. Imm("You must provide a name!"):ENDPROD
  1076. start%=!menhand%
  1077. end%=start%+!(start%-4)
  1078. start%+=4
  1079.  x%=start% 
  1080.  end%:
  1081.  ?x%=0 
  1082.  ?x%=&A
  1083. f%=end%-start%-4
  1084. "WimpExt_DataSave",f%,path$,&FFF,start%,1,0
  1085. "Wimp_CreateMenu",,-1
  1086. Saveerror(ptr%)
  1087.  x%=start% 
  1088.  end%:
  1089.  ?x%=&A 
  1090.  ?x%=0
  1091.  block%!20<>0 
  1092. error$=
  1093. String(block%+28)
  1094. Imm("'"+error$+"' file may not have saved compleatly")
  1095. LCString(ptr%)
  1096.  ?ptr%>25 
  1097. tx$<255
  1098. x%=?ptr%
  1099.  tx$+=
  1100. (?ptr% 
  1101.  1<<6):ptr%+=1
  1102.